Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add selecting network circuit #621

Merged
merged 5 commits into from
Mar 27, 2024
Merged

Conversation

xThaid
Copy link

@xThaid xThaid commented Mar 18, 2024

I didn't call it sorting network, because in fact it doesn't sort -- we don't care about items that are not valid. We only select valid inputs and group them together.

The generated circuit looks nice (n=6):
https://digitaljs.tilk.eu/#2cde77f56b8cfd56a81defc25c4adc6257fc3f60f78f301a38ddc4a7d7330310

@xThaid xThaid added the enhancement New feature or request label Mar 18, 2024
transactron/lib/connectors.py Show resolved Hide resolved
merged = Array(Signal(self.layout) for _ in range(total_len))

for i in range(len(a)):
m.d.comb += merged[i].eq(Mux(cnt_a <= i, b[i - cnt_a], a[i]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generates a lot of subtractors. Why you doesn't use shifts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a problem. These are not proper substractions. In fact, the synthesis tool can permutate inputs of the mux and simply address it using cnt_a.

Shifting by variable number of bits in particular won't be better than a mux.

transactron/lib/connectors.py Outdated Show resolved Hide resolved
@tilk tilk merged commit a222ebd into kuznia-rdzeni:master Mar 27, 2024
8 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 27, 2024


@parameterized_class(
("n"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ("n",)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out - it should. However, apparently this decorator correctly handles this case:

    if isinstance(attrs, string_types):
        attrs = [attrs]

tilk pushed a commit to kuznia-rdzeni/transactron that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants